#include <iostream>
#include <string>
#include <cmath>

int main() {
    int g = 0;
    std::string a;
    std::getline(std::cin, a);
    std::string b[3];
    std::size_t pos = 0;
    std::string delimiter = " ";
    int i = 0;
    while ((pos = a.find(delimiter)) != std::string::npos) {
        b[i] = a.substr(0, pos);
        a.erase(0, pos + delimiter.length());
        i++;
    }
    b[i] = a;

    int b1, b2, b3;
    if (b[0] == "zero") {
        b1 = 0;
    } else if (b[0] == "one") {
        b1 = 1;
    } else if (b[0] == "two") {
        b1 = 2;
    } else if (b[0] == "three") {
        b1 = 3;
    } else if (b[0] == "four") {
        b1 = 4;
    } else if (b[0] == "five") {
        b1 = 5;
    } else if (b[0] == "six") {
        b1 = 6;
    } else if (b[0] == "seven") {
        b1 = 7;
    } else if (b[0] == "eight") {
        b1 = 8;
    } else if (b[0] == "nine") {
        b1 = 9;
    } else {
        std::cout << "Wrong input" << std::endl;
        return 1;
    }

    if (b[1] == "zero") {
        b2 = 0;
    } else if (b[1] == "one") {
        b2 = 1;
    } else if (b[1] == "two") {
        b2 = 2;
    } else if (b[1] == "three") {
        b2 = 3;
    } else if (b[1] == "four") {
        b2 = 4;
    } else if (b[1] == "five") {
        b2 = 5;
    } else if (b[1] == "six") {
        b2 = 6;
    } else if (b[1] == "seven") {
        b2 = 7;
    } else if (b[1] == "eight") {
        b2 = 8;
    } else if (b[1] == "nine") {
        b2 = 9;
    } else {
        std::cout << "Wrong input" << std::endl;
        return 1;
    }

    if (b[2] == "zero") {
        b3 = 0;
    } else if (b[2] == "one") {
        b3 = 1;
    } else if (b[2] == "two") {
        b3 = 2;
    } else if (b[2] == "three") {
        b3 = 3;
    } else if (b[2] == "four") {
        b3 = 4;
    } else if (b[2] == "five") {
        b3 = 5;
    } else if (b[2] == "six") {
        b3 = 6;
    } else if (b[2] == "seven") {
        b3 = 7;
    } else if (b[2] == "eight") {
        b3 = 8;
    } else if (b[2] == "nine") {
        b3 = 9;
    } else {
        std::cout << "Wrong input" << std::endl;
        return 1;
    }

    int d = std::stoi(std::to_string(b1) + std::to_string(b2) + std::to_string(b3));
    for (int i = 2; i <= d / 2; i++) {
        if (d % i == 0) {
            g++;
        }
    }
    if (g == 0) {
        std::cout << d << std::endl;
    } else {
        for (int i1 = d + 1; i1 <= std::pow(d, d); i1++) {
            g = 0;
            for (int i = 2; i <= d / 2; i++) {
                if (i1 % i == 0) {
                    g++;
                }
            }
            if (g == 0) {
                std::cout << i1  << std::endl;
                break;
            }
        }
    }

    return 0;
}